package cn.csq;

/**
 * @author <a href="mailto:csq02198031@alibaba-inc.com">chengshanqing</a>
 * @date 2025/9/24 14:40
 */
public class ThreadStatusTest {

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            System.out.println("thread run");
        });
        thread.start();
        thread.setName("self thread");
        Thread.State state = thread.getState();
        System.out.println("thread name:" + thread.getName() + "state:" + state);


        Thread.sleep(100);
        System.out.println("main thread ");
        Thread.State state2 = thread.getState();
        System.out.println("thread name:" + thread.getName() + "state:" + state2);


        synchronized (ThreadStatusTest.class) {
            while (true) {
                thread.wait();
            }
        }
    }
}

